adblock: update 2.8.2
authorDirk Brenken <[email protected]>
Thu, 29 Jun 2017 13:34:18 +0000 (15:34 +0200)
committerDirk Brenken <[email protected]>
Thu, 29 Jun 2017 13:34:18 +0000 (15:34 +0200)
* made DNS restart conditional (compare list hash values),
  to prevent needless restarts of the DNS backend

Signed-off-by: Dirk Brenken <[email protected]>
net/adblock/Makefile
net/adblock/files/adblock.sh

index 5141a7607c329ea089e9e6aded416514f6ca1e75..4b387977e2eaaae530551e84b82dbd8075b78593 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
-PKG_VERSION:=2.8.1
+PKG_VERSION:=2.8.2
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <[email protected]>
index 04c19066b34e7aa7c93a40b4b5ce3749e8a86dc5..7c3112877774c90c4e7fc552dd23b60aa6275948 100755 (executable)
@@ -10,7 +10,7 @@
 #
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-adb_ver="2.8.1"
+adb_ver="2.8.2"
 adb_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
 adb_enabled=1
 adb_debug=0
@@ -436,7 +436,7 @@ f_log()
 #
 f_main()
 {
-    local src_name src_rset shalla_archive enabled url cnt=0
+    local src_name src_rset shalla_archive enabled url hash_old hash_new cnt=0
     local mem_total="$(awk '/^MemTotal/ {print int($2/1000)}' "/proc/meminfo")"
 
     f_log "info " "start adblock processing ..."
@@ -535,8 +535,12 @@ f_main()
         fi
     done
 
-    # overall sort
+    # hash preparation & overall sort
     #
+    if [ -f "${adb_dnsdir}/${adb_dnsfile}" ]
+    then
+        hash_old="$(sha256sum "${adb_dnsdir}/${adb_dnsfile}" | awk '{print $1}')"
+    fi
     if [ -s "${adb_tmpdir}/${adb_dnsfile}" ]
     then
         if [ ${mem_total} -ge 64 ] || [ ${adb_forcesrt} -eq 1 ]
@@ -548,13 +552,17 @@ f_main()
     else
         > "${adb_dnsdir}/${adb_dnsfile}"
     fi
+    hash_new="$(sha256sum "${adb_dnsdir}/${adb_dnsfile}" | awk '{print $1}')"
     cnt="$(wc -l < "${adb_dnsdir}/${adb_dnsfile}")"
 
-    # restart the dns backend and export runtime information
+    # conditional restart of the dns backend and runtime information export
     #
     chown "${adb_dns}":"${adb_dns}" "${adb_dnsdir}/${adb_dnsfile}" 2>/dev/null
     f_rmtemp
-    f_dnsrestart
+    if [ "${hash_old}" != "${hash_new}" ]
+    then
+        f_dnsrestart
+    fi
     if [ ${?} -eq 0 ]
     then
         json_init